﻿using rmTest.Common.ModelUtil;
using rmTest.Common.AttrUtil;
using System;
using rmTest.Common;

namespace rmTest.First.Model
{
    [TableName("User")]
    public class UserModel : BaseModel
    {
        [ModelValidate(MinCharLength = 3, MaxCharLength = 50)]
        public string Name { get; set; }

        [ModelValidate(true, MaxCharLength = 100)]
        public string Account { get; set; }

        [ModelValidate(true, MaxCharLength = 100)]
        public string Password { get; set; }

        [ModelValidate(MaxCharLength = 200)]
        public string Email { get; set; }

        [ModelValidate(MaxCharLength = 30)]
        public string Mobile { get; set; }

        [ModelValidate(true)]
        public int CompanyId { get; set; }

        [ModelValidate(true, MaxCharLength = 500)]
        public string CompanyName { get; set; }

        [ModelValidate(true, MaxRange = (int)UserState.Deleted, MinRange = (int)UserState.Normal)]
        public int State { get; set; }

        [ModelValidate(Ignored = true), EnumMap(typeof(UserState), "State")]
        public string State2Name { get; set; }

        [ModelValidate(true, MaxRange = (int)UserType.Admin, MinRange = (int)UserType.Visitor), Display("UserType")]
        public int Type { get; set; }

        [ModelValidate(Ignored = true), EnumMap(typeof(UserType), "Type")]
        public string Type2Name { get; set; }
        public DateTime LastLoginTime { get; set; }

    }
}
